<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>CruiseControl.NET : Custom Builder Plug-in</title>
	    <link rel="stylesheet" href="styles/site.css" type="text/css" />
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">	    
    </head>

    <body>
	    <table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
		    <tr>
			    <td valign="top" class="pagebody">
				    <div class="pageheader">
					    <span class="pagetitle">
                            CruiseControl.NET : Custom Builder Plug-in
                                                    </span>
				    </div>
				    <div class="pagesubheading">
					    This page last changed on Jun 30, 2009 by <font color="#0050B2">williams</font>.
				    </div>

				    <h3><a name="CustomBuilderPlug-in-Steps%3A"></a>Steps:</h3>

<ol>
	<li>Create a Class Library project to build the assembly that will contain your custom builder plug-in. The assembly that it produces should be named: '<em>ccnet.*.plugin.dll</em>' (where the star represents the name you choose).</li>
	<li>Add your new custom builder class.</li>
	<li>The class must implement the <em>ThoughtWorks.CruiseControl.Core.ITask</em> interface (found in the ThoughtWorks.CruiseControl.Core.dll assembly).</li>
	<li>Mark your class with the <a href="NetReflector.html" title="NetReflector">NetReflector</a> <em>ReflectorType</em> attribute. The <em>name</em> argument supplied to the attribute is the name of the element/attribute that will appear in the configuration file.</li>
	<li>Add any configuration properties that you need, marking them with the <a href="NetReflector.html" title="NetReflector">NetReflector</a> <em>ReflectorProperty</em> attributes accordingly. Note that the attribute names are case sensitive and must match exactly in the configuration.</li>
	<li>Implement the <em>Run</em> method. The supplied <em>IIntegrationResult</em> should provide you with everything that you need to know about the current build.</li>
	<li>Compile the assembly.</li>
	<li>Copy the assembly into the folder containing the CruiseControl.NET assemblies (or the current directory that you are running the ccnet server from).</li>
	<li>Modify your <em>ccnet.config</em> file in accordance with the sample config file below.</li>
</ol>


<h3><a name="CustomBuilderPlug-in-SampleBuilderClass"></a>Sample Builder Class</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">using <span class="code-object">System</span>;
using Exortech.NetReflector;
using ThoughtWorks.CruiseControl.Core;

namespace ThoughtWorks.CruiseControl.Sample.Builder
{
	[ReflectorType(<span class="code-quote">"mybuilder"</span>)]
	<span class="code-keyword">public</span> class NAntBuilder : ITask
	{
		<span class="code-keyword">public</span> void Run(IIntegrationResult result)
		{
			Console.WriteLine(<span class="code-quote">"Hello World!"</span>);
		}
	}
}</pre>
</div></div>

<h3><a name="CustomBuilderPlug-in-SampleConfigFile"></a>Sample Config File</h3>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">&lt;cruisecontrol&gt;
	&lt;project name=<span class="code-quote">"myproject"</span>&gt;
		&lt;tasks&gt;
			&lt;mybuilder&gt;
				&lt;!-- include custom builder properties here --&gt;
			&lt;/mybuilder&gt;
		&lt;/tasks&gt;
	&lt;/project&gt;
&lt;/cruisecontrol&gt;</pre>
</div></div>
<p>For a more detailed explanation visit this <a href="http://rubenwillems.blogspot.com/search/label/customizing%20code">blog</a>section Customizing Code</p>

				    
                    			    </td>
		    </tr>
	    </table>
	    <table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td height="12" background="http://confluence.public.thoughtworks.org//images/border/border_bottom.gif"><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
			</tr>
		    <tr>
			    <td align="center"><font color="grey">Document generated by Confluence on Sep 29, 2009 20:59</font></td>
		    </tr>
	    </table>
    </body>
</html>